/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter3;

import java.util.Date;

/**
 *
 * @author Denise Carolina
 */
public class GarbageCollection {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Runtime rt = Runtime.getRuntime();
        System.out.println("JVM memory:: " + rt.totalMemory());
        System.out.println("Free memory:: " + rt.freeMemory());

        Date d = null;
        for (int i = 0; i < 10000; i++){
            d = new Date();
            d = null;
        }
        System.out.println("After memory:: " + rt.freeMemory());
        rt.gc();
        System.out.println("After GC memory:: " + rt.freeMemory());
    }

}
